<?php
/**
 * Created by PhpStorm.
 * User: jack Wang
 * Date: 2021/12/16
 * Time: 15:01
 */

class Prop  extends Base_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->service('Prop_service');
    }

    //用户背包道具列表
    public function prop()
    {
       $data = $this->input->post();
       if (empty($data['uid'])){
           fail(400,'用户id不能为空');
       }
       responseArray($this->Prop_service->myProp($data['uid']));
    }

    //使用道具
    public function useProp()
    {
        $data = $this->input->post();
        if (empty($data['uid']) || empty($data['prid']) || empty($data['num']) || $data['num'] < 0) {
            fail(400, '参数错误');
        }
        responseArray($this->Prop_service->useProp($data['uid'], $data['prid'], $data['num']));
    }
}